package com.wchat.utils;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;

/**
 * Created by yangtianrui on 17/8/17.
 */
public class JsonUtils {

    /**
     * 工具类  把对象转化为 json格式
     * @param object 传入对象
     * @return
     */
    public static String toJson(Object object)
    {
        GsonBuilder gsonBuilder = new GsonBuilder();
        gsonBuilder.setPrettyPrinting();
        Gson gson = gsonBuilder.create();
        return gson.toJson(object);
    }


}
